package io;

import java.io.*;

public class IODemo10 {
    public static void main(String[] args) throws IOException {
        //使用字符流读取文件
       try(Reader reader = new FileReader("./test.txt")){
           while(true){
               //读取文件,以字符为单位进行读取了
               char[] buffer = new char[1024];
               int n = reader.read(buffer);
               if(n == -1){
                   break;
               }
//               String s = new String(buffer,0,n);
//               System.out.println(s);
               for (int i = 0; i < n; i++) {
                   System.out.print(buffer[i]+" ");
               }
           }
       }
    }
}
